package com.dkm.orproject.dkmoa.service.serviceimpl.flow;

import com.dkm.orproject.dkmoa.dao.OaEntryWorkMapper;
import com.dkm.orproject.dkmoa.domain.OaEntryWork;
import com.dkm.orproject.dkmoa.service.flow.OaEntryWorkService;
import com.dkm.orproject.utils.utils.IdToobtainUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * @PROJECT_NAME: orproject
 * @DESCRIPTION:
 * @USER: 周佳佳
 * @DATE: 2020/8/10 14:20
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class OaEntryWorkServiceimpl implements OaEntryWorkService {
    @Autowired
    OaEntryWorkMapper oaEntryWorkMapper;
    @Resource
    IdToobtainUtils utils;
    /**
     * 工作经历增加方法
     * @param record 对象
     * @return 返回行数
     */
    @Override
    public int insertSelective(OaEntryWork record) {
        //d为随机生成
        record.setPkWorkId(utils.getNumberId());
        return oaEntryWorkMapper.insertSelective(record);
    }
    /**
     * 根据主键查询
     * @param pkWorkId 主键
     * @return 返回对象
     */
    @Override
    public OaEntryWork selectByPrimaryKey(Long pkWorkId) {
        return oaEntryWorkMapper.selectByPrimaryKey(pkWorkId);
    }
    /**
     * 修改或逻辑删除方法
     * @param record 参数对象
     * @return 返回行数
     */
    @Override
    public int updateByPrimaryKeySelective(OaEntryWork record) {
        return oaEntryWorkMapper.updateByPrimaryKeySelective(record);
    }
    /**
     * 根据流程id查询工作经历
     * @param entryId 流程id
     * @return 返回集合
     */
    @Override
    public List<OaEntryWork> selectAll(Long entryId) {
        return oaEntryWorkMapper.selectAll(entryId);
    }
    /**
     * 根据流程id查询工作经历(人员信息变更流程)
     * @param entryId 流程id
     * @return 返回集合
     */
    @Override
    public List<OaEntryWork> selectAlls(Long entryId) {
        return oaEntryWorkMapper.selectAlls(entryId);
    }
}
